/** @jsxImportSource @emotion/react */
import * as React from "react";
import {CCell, Cell, RCell, Table, TableBody, TableRow, Text} from "customize-easy-ui-component";
import {RepLink} from "../../common/base";
import Img_Seal from "../../../images/seal.png";
import {AttentionPoint} from "../../common/rarelyVary";

export const 首页概况BoilerLe= ({theme, orc, rep } :{theme: any, orc:any, rep:any}
) => {
  return <Table fixed={ ["20%","%"] }  css={ {borderCollapse: 'collapse'} }>
    <TableBody rheight={40}>
      <TableRow>
        <RCell css={{border:'none'}}>锅炉使用单位：</RCell>
        <CCell css={{border:'none',borderBottom:`1px dashed`}}>{orc.使用单位 || '／'}</CCell>
      </TableRow>
      <TableRow >
        <RCell css={{border:'none'}}>分支机构：</RCell>
        <CCell css={{border:'none',borderBottom:`1px dashed`}}>{orc?.分支机构 || '／'}</CCell>
      </TableRow>
      <TableRow>
        <RCell css={{border:'none'}}>锅炉型号：</RCell>
        <CCell css={{border:'none',borderBottom:`1px dashed`}}>{orc?.型号 || '／'}</CCell>
      </TableRow>
      <TableRow >
        <RCell css={{border:'none'}}>设备代码：</RCell>
        <CCell css={{border:'none',borderBottom:`1px dashed`}}>{orc.设备代码 || '／'}</CCell>
      </TableRow>
      <TableRow >
        <RCell css={{border:'none'}}>锅炉使用证号：</RCell>
        <CCell css={{border:'none',borderBottom:`1px dashed`}}>{orc?.使用证号 || '／'}</CCell>
      </TableRow>
      <TableRow>
        <RCell css={{border:'none'}}>检验日期：</RCell>
        {orc.检验日期1? <CCell css={{border:'none',borderBottom:`1px dashed`}}>{orc.检验日期1} 至 {orc.检验日期}</CCell>
            :
            <CCell css={{border:'none',borderBottom:`1px dashed`}}>{orc.检验日期}</CCell>
        }
      </TableRow>
    </TableBody>
  </Table>;
};

//测试人员： 报告这里没有录入的。采用业务生成的？
export const 编制审核部分 = ({theme, orc, rep,}: { theme: any, orc: any, rep: any, }
) => {
  //fontSize: theme.fontSizes[0],
  //【字体大小一致性】 确保字体一致 0.875rem 是来自Cell默认 @ 但，非表格内的其它文本 默认 font-size: 1rem;
  return <>
    <Table fixed={["65%", "%"]} css={{borderCollapse: 'collapse'}} tight miniw={800}>
      <TableBody>
        <RepLink rep={rep} tag={'Conclusion'}>
          <TableRow>
            <Cell colSpan={2}>
              <div css={{margin: '0 0.5rem', whiteSpace: 'pre-wrap'}}>
                检验人员：&nbsp;{orc.检验人IDs ?? '／'}
              </div>
            </Cell>
          </TableRow>
          <TableRow>
            <Cell>
              <div css={{margin: '0 0.5rem', display: 'flex', justifyContent: 'space-between'}}>
                <Text css={{fontSize: '0.875rem'}}>编制：&nbsp;{orc.检验人IDs ?? '／'}</Text>
                <Text css={{fontSize: '0.875rem'}}>2027-07-31</Text>
              </div>
            </Cell>
            <CCell rowSpan={3}>
              <div css={{
                height: '7rem',
                '::before': {
                  filter: 'opacity(30%)',
                  width: '100%',
                  height: '100%',
                  backgroundImage: `url(${Img_Seal})`,
                  content: '" "',
                  position: 'absolute',
                  top: 0,
                  left: 0,
                  backgroundRepeat: 'no-repeat',
                  backgroundPosition: 'center',
                }
              }}>
                <Table fixed={["40%", "%"]} css={{borderCollapse: 'collapse', height: 'fill-available'}} tight
                       miniw={800}>
                  <TableBody>
                    <TableRow>
                      <CCell css={{border: 'none'}}>机构核准证号：</CCell>
                      <CCell css={{border: 'none'}}>{rep?.isp?.ispu?.agency?.apno}</CCell>
                    </TableRow>
                    <TableRow>
                      <CCell css={{border: 'none'}} colSpan={2}>（检验机构公章或者检验专用章）</CCell>
                    </TableRow>
                    <TableRow>
                      <CCell css={{border: 'none'}}>日期：</CCell>
                      <Cell css={{border: 'none'}}>2024/03/04</Cell>
                    </TableRow>
                  </TableBody>
                </Table>
              </div>
            </CCell>
          </TableRow>
        </RepLink>
        <TableRow>
          <Cell>
            <div css={{margin: '0 0.5rem', display: 'flex', justifyContent: 'space-between'}}>
              <Text css={{fontSize: '0.875rem'}}>审核：&nbsp;{orc.检验人IDs ?? '／'}</Text>
              <Text css={{fontSize: '0.875rem'}}></Text>
            </div>
          </Cell>
        </TableRow>
        <TableRow>
          <Cell>
            <div css={{margin: '0 0.5rem', display: 'flex', justifyContent: 'space-between'}}>
              <Text css={{fontSize: '0.875rem'}}>审批：&nbsp;{orc.检验人IDs ?? '／'}</Text>
              <Text css={{fontSize: '0.875rem'}}></Text>
            </div>
          </Cell>
        </TableRow>
      </TableBody>
    </Table>
  </>;
};

export const 注意事项BoilerLe= ({comply, rep} :{comply?: any, rep: any}
) => {
  //中间组件只带了第一行的内容 1．本报告{comply}。<br/>  参数telurl：是否显示报检方式；最后一行跟随的！
  return <AttentionPoint rep={rep} comply={comply} telurl>
    2．本报告应当打印输出，或者用钢笔、签字笔填写，字迹要工整，涂改无效。<br/>
    3．本报告无检验、审核、批准人员的签字和检验机构的核准证号、机构检验专用章，无效。<br/>
    4．本报告一式两份，由检验机构和使用单位分别保存。<br/>
    5．受检单位对本报告如有异议，请在收到报告书之日起15个工作日内，向检验机构提出书面意见。<br/>
    6．本报告对样品检验时的状况负责。<br/>
    7．
  </AttentionPoint>;
};
